package model

import business.Destoryable
import org.itheima.kotlin.game.core.Painter


/** 爆炸物
 * 可销毁的
 * */
class Blast(override val x: Int, override val y: Int) :IView,Destoryable{
    override val width: Int=GameConfig.BLOCK_WIDTH
    override val height: Int=GameConfig.BLOCK_WIDTH

    val blastImagePaths=ArrayList<String>()

    var index=0
    init {
        (1 .. 32).forEach {
            blastImagePaths.add("img/blast_${it}.png")
        }
    }
    override fun draw() {
        var i=index % blastImagePaths.size

        Painter.drawImage(blastImagePaths.get(i),x,y)

        index++
    }

    override fun isDestory(): Boolean {
        return  index>=blastImagePaths.size
    }

}